package com.bwie.controller;

import com.bwie.common.domain.request.LoginReq;
import com.bwie.common.domain.response.LoginResp;
import com.bwie.common.result.Result;
import com.bwie.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @className: LoginController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 郑伦
 * @date: 2025/7/31 10:03
 **/
@RestController
public class LoginController {

    //自动装配service层
    @Autowired
    LoginService loginService;

    /**
     * 登录认证
     * @param loginReq
     * @return
     */
    @PostMapping("/loginUser")
    public Result<LoginResp> loginUser(@RequestBody @Valid LoginReq loginReq){
        LoginResp loginResp = loginService.loginUser(loginReq);
        return Result.success(loginResp);
    }
}